package com.howie.parnote.jms.sender;

import com.howie.parnote.module.LoginInfoModule;
import org.springframework.stereotype.Component;

import javax.jms.*;

/**
 * <p>Title: parnote</p>
 * <p>
 * Description: parnote
 * </p>
 *
 * @author huangyan
 *         Created by HY on 2015/4/18 0018.
 * @version v1.0.0
 */
@Component
public class ConfirmEmailMessageSender extends AbstractMessageSender {

	public static final String CONFIRM_EMAIL_SUBJECT = "EMAIL.CONFIRM";

	private LoginInfoModule loginInfoModule;

	public ConfirmEmailMessageSender() {
	}

	@Override
	protected Message createMessage(Session session) throws JMSException {
		ObjectMessage message = session.createObjectMessage();
		message.setObject(loginInfoModule);
		return message;
	}

	@Override
	protected Destination createDestination(Session session) throws JMSException {
		return session.createQueue(CONFIRM_EMAIL_SUBJECT);
	}


	@Override
	public void setSendObject(Object object) {
		this.loginInfoModule = (LoginInfoModule) object;
	}
}
